package com.cwh.springbootMybatis.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @ClassName MessagePlatController
 * @Description TODO
 * @Author zhcg
 * @Date 2021/7/2 9:45 上午
 * @Version 1.0
 **/
@RestController
@RequestMapping("/NSSC_IS/out/sms")
public class MessagePlatController {

    @Value("${message.plat.flag}")
    private String messagePlatFlag;

    @RequestMapping("/doBiz")
    public String sendMessage(HttpServletRequest request){
        System.out.println("短信平台接收到信息---");
        System.out.println("bizType-->"+request.getParameter("bizType"));
        System.out.println("phones-->"+request.getParameter("phones"));
        System.out.println("content-->"+request.getParameter("content"));
        System.out.println(messagePlatFlag);
        if("success".equals(messagePlatFlag)){
            return "0|发送成功";
        }else if("fail".equals(messagePlatFlag)){
            return "1|李可定义的失败";
        }else if("error".equals(messagePlatFlag)){
            throw new RuntimeException("李可抛了个异常");
        }else{
            System.out.println("message.plat.flag未定义");
            return "1|未定义的标志码";
        }
    }

    @RequestMapping("/test")
    public String test(){
        System.out.println("短信平台接收到信息---");
        return "1";
    }

}
